#pragma once

#ifndef EDITOR__SETTINGS__MAP__HH__
#define EDITOR__SETTINGS__MAP__HH__

#include <string>
#include <unordered_map>
#include <LitEditorPrerequisites.h>

namespace Lit
{
	namespace Editor
	{
		LIT_API enum SettingsType
		{
			ST_INT,
			ST_FLOAT,
			ST_DOUBLE,
			ST_BOOL,
			ST_STRING,
			ST_STRINGLIST,
			ST_VECTOR2,
			ST_VECTOR3,
			ST_VECTOR4,
			ST_QUATERNION,
			ST_MATRIX3,
			ST_MATRIX4,
			ST_COLOR
		};


		typedef triplet<std::string, std::string, SettingsType>	SettingsValue;
		LIT_API std::ostream& operator << ( std::ostream& stream, const SettingsValue& val );

		class LIT_API SettingsMap
		{
		public:
			typedef std::unordered_map<std::string, SettingsValue>		type;
			typedef type::iterator										itor;
			typedef type::const_iterator								const_itor;

		protected:
			type map;
			std::string name_val_sep;
			std::string property_sep;

		public:
			SettingsMap( const std::string& name_value_separator = ":", const std::string& property_separator = ";;" );
			SettingsMap( const SettingsMap& lst );
			~SettingsMap();
			
			bool operator == ( const SettingsMap& rk ) const;
			bool operator != ( const SettingsMap& rk ) const;
			SettingsMap& updateValue( const std::string &name, const std::string& val );
			SettingsMap& setValue( const SettingsValue& val );
			SettingsValue* getValue( const std::string &name );
			const SettingsValue* getValue( const std::string &name ) const;
			bool hasValue( const std::string &name ) const;
			size_t size() const;
			void clear();

			itor begin();
			itor end();
			const_itor begin() const;
			const_itor end() const;

			std::string toString() const;
		};
	};
};

#endif